package com.thx.appserver.dao;

import java.text.SimpleDateFormat;
import java.util.Date;

import org.springframework.stereotype.Repository;

import com.thx.appserver.model.CappSplashImg;
import com.thx.common.orm.PaginationDao;

@Repository
public class CappSplashImgDao extends PaginationDao<CappSplashImg> {
	
	public CappSplashImg getNewSplashImg(){
		String hql = "from CappSplashImg u where u.endDate > STR_TO_DATE('"+new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())+"','%Y-%m-%d %H:%i:%s') order by u.createDate desc";
		return (CappSplashImg) getSession().createQuery(hql).setMaxResults(1).uniqueResult();
	}

}
